package com.zmj.sy.mom.srv.aps.utils.diff;

import com.zmj.sy.mom.srv.aps.bean.vo.consistency.ConsistencyCheckReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.consistency.ConsistencyCheckDataResVo;
import com.zmj.sy.mom.srv.aps.feign.ApsMesFeign;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.Comparator;
import java.util.List;

@RequiredArgsConstructor
@Component
public class MesDiffRule implements DiffRule {

    private final ApsMesFeign apsMesFeign;


    @Override
    public List<ConsistencyCheckDataResVo> getData(ConsistencyCheckReqVo reqVo) {
        List<ConsistencyCheckDataResVo> part = apsMesFeign.part(reqVo);
        part.sort(Comparator.comparing(ConsistencyCheckDataResVo::getPlmId));
        return part;
    }

    @Override
    public String getCode() {
        return MES_CODE;
    }

}
